<template>
  <view class="clearcar-bg">
    <!-- 顶部栏 -->
    <view class="clearcar-header">
      <view class="header-title">专业洗车</view>
    </view>
    <!-- 搜索框 -->
    <view class="search-bar">
      <input class="search-input" placeholder="输入想要查找的内容" />
      <image src="/static/yyq/search.png" class="search-icon" />
    </view>
    <!-- 历史记录 -->
    <view class="history-row">
      <view class="history-tags">
        <text class="history-label">历史记录：</text>
        <view v-for="(item, idx) in historyTags" :key="idx" class="history-tag">{{ item }}</view>
      </view>
    </view>
    <!-- 洗车店列表 -->
    <view class="shop-list">
      <view class="shop-card" v-for="(shop, idx) in shopList" :key="idx">
        <image :src="shop.img" class="shop-img" mode="aspectFill" />
        <view class="shop-info">
          <view class="shop-title-row">
            <view class="shop-title">{{ shop.name }}</view>
            <view class="shop-distance">{{ shop.distance }}</view>
          </view>
          <view class="shop-meta">
            <text class="star">★</text>
            <text class="score">{{ shop.score }}</text>
            <text class="meta-split">|</text>
            <text class="meta-label">销量：</text>
            <text class="meta-value">{{ shop.sales }}</text>
          </view>
          <view class="shop-time">营业时间：{{ shop.time }}</view>
          <view class="shop-addr">{{ shop.addr }}</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue';
const historyTags = ref(['飞飞汽车美容', '飞飞汽车装饰', '飞飞汽车养护', '内饰清洗']);
const filterTags = ref(['飞飞汽车美容', '飞飞汽车装饰', '飞飞汽车养护', '内饰清洗']);
const shopList = ref([
  {
    name: '车百事汽车生活馆',
    img: '/static/yyq/carwash.jpg',
    score: '4.9',
    sales: 556,
    time: '周一-至周五  8:00-22:00',
    addr: '山阳区人民路和政和路交叉口',
    distance: '556m',
  },
  {
    name: '车百事汽车生活馆',
    img: '/static/yyq/carwash.jpg',
    score: '4.9',
    sales: 556,
    time: '周一-至周五  8:00-22:00',
    addr: '山阳区人民路和政和路交叉口',
    distance: '556m',
  },
  {
    name: '车百事汽车生活馆',
    img: '/static/yyq/carwash.jpg',
    score: '4.9',
    sales: 556,
    time: '周一-至周五  8:00-22:00',
    addr: '山阳区人民路和政和路交叉口',
    distance: '5.6km',
  },
  {
    name: '车百事汽车生活馆',
    img: '/static/yyq/carwash.jpg',
    score: '4.9',
    sales: 556,
    time: '周一-至周五  8:00-22:00',
    addr: '山阳区人民路和政和路交叉口',
    distance: '556m',
  },
  {
    name: '车百事汽车生活馆',
    img: '/static/yyq/carwash.jpg',
    score: '4.9',
    sales: 556,
    time: '周一-至周五  8:00-22:00',
    addr: '山阳区人民路和政和路交叉口',
    distance: '556m',
  },
]);
</script>

<style scoped lang="scss">
.clearcar-bg {
  min-height: 100vh;
  background: linear-gradient(180deg, #338aff 0%, #338aff 120px, #f5f6fa 120px, #f5f6fa 100%);
  padding-bottom: 24px;
}
.clearcar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  position: relative;
}
.header-title {
  flex: 1;
  text-align: center;
  font-size: 22px;
  font-weight: bold;
}
.header-icons {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
}
.iconfont {
  font-size: 22px;
  color: #fff;
  margin-left: 12px;
}
.search-bar {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 24px;
  margin: 0 16px;
  margin-top: 8px;
  padding: 8px 16px;
  box-shadow: 0 2px 8px rgba(51,138,255,0.08);
  position: relative;
}
.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  color: #333;
  background: none;
}
.search-icon {
  width: 20px;
  height: 20px;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}
.history-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin: 25px 20px 0; // 微调外边距，增加上下间距并让左右更宽
  font-size: 14px;
  color: #666; // 加深文字颜色，提高可读性
  justify-content: space-between; // 让标签和清空按钮分布在两端
  padding-bottom: 12px; // 底部内边距，为下方内容留出空间
  border-bottom: 1px solid #e0e0e0; // 添加底部边框，区分不同区域
}

.history-label {
  margin-right: 12px; // 适当增加右侧间距
  font-weight: 500; // 让标签文字加粗
  color: #333; // 加深标签文字颜色
}

.history-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px; // 使用 gap 替代 margin 来设置标签之间的间距
}

.history-tag {
  background: #fff; // 改为白色背景
  border: 1px solid #d9d9d9; // 添加边框
  border-radius: 16px; // 增大圆角半径
  color: #338aff;
  padding: 2px 4px;
  font-size: 14px;
  cursor: pointer; // 提示可点击
  transition: all 0.3s ease; // 添加过渡效果

  &:hover {
    background: #e6f7ff; // 鼠标悬停时的背景颜色
    border-color: #338aff; // 鼠标悬停时的边框颜色
    transform: translateY(-2px); // 鼠标悬停时向上移动
  }
}

.clear-history {
  color: #ff4d4f;
  cursor: pointer;
  font-size: 14px;
  transition: color 0.3s ease; // 添加颜色过渡效果

  &:hover {
    color: #ff7875; // 鼠标悬停时的颜色
  }
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  margin: 8px 16px 0 16px;
}
.filter-tag {
  background: #f5f6fa;
  border-radius: 12px;
  color: #338aff;
  padding: 4px 14px;
  margin-right: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}
.shop-list {
  margin: 12px 0 0 0;
}
.shop-card {
  background: #fff;
  border-radius: 16px;
  margin: 0 16px 16px 16px;
  display: flex;
  box-shadow: 0 2px 8px rgba(51,138,255,0.04);
  overflow: hidden;
}
.shop-img {
  width: 100px;
  height: 90px;
  object-fit: cover;
  border-radius: 16px 0 0 16px;
  margin-right: 10px;
}
.shop-info {
  flex: 1;
  padding: 12px 0 12px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.shop-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.shop-title {
  font-size: 16px;
  font-weight: bold;
  color: #222;
}
.shop-distance {
  color: #338aff;
  font-size: 14px;
}
.shop-meta {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: #888;
  margin: 4px 0;
}
.star {
  color: #ff9800;
  margin-right: 2px;
}
.score {
  color: #ff9800;
  margin-right: 6px;
}
.meta-split {
  margin: 0 6px;
}
.meta-label {
  color: #888;
}
.meta-value {
  color: #338aff;
}
.shop-time {
  font-size: 13px;
  color: #888;
  margin-bottom: 2px;
}
.shop-addr {
  font-size: 13px;
  color: #888;
}
</style>
